<template>
  <div class="card-wrap">
    <div class="playnum">
      <img class="playnum-img" src="../../static/homeimg/play.png">
      <span>{{ playnum.toFixed(2) }}万</span>
    </div>
    <div class="card">

      <img :src="url">
      <div class="card-text">
        {{ title }}

      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import homeApi, { type AlbumsModel, type AlbumsModelList, type subscriptInfoModel, type limitedTimeFreeAlbumModel } from "@/api/home"
import { onMounted } from "vue";
import { ref } from "vue";
const props = defineProps<{
  item?: AlbumsModel,
  limit?: limitedTimeFreeAlbumModel

}>()
let urlP = "http://imagev2.xmcdn.com/"
let playnum = ref(0)
let url = ref("")
let title = ref("")
const justice = () => {
  if (!!props.item) {
    playnum.value = props.item?.albumPlayCount as number / 10000;
    url.value = urlP + props.item?.albumCoverPath;
    title.value = props.item.albumTitle
  }
  if (!!props.limit) {
    playnum.value = props.limit.playCount / 10000
    url.value = props.limit.coverPath
    title.value = props.limit.title
  }
}
onMounted(() => {
  justice()
})
</script>

<style lang="scss" scoped>
.card-wrap {
  position: relative;
}

.playnum {
  border-radius: 10px;

  img {
    border-radius: 10px;
  }

  .playnum-img {
    width: 15px;
    height: 15px;
    position: absolute;
    // right: -30px;
    top: 93px;
    // right: 10px;
    z-index: 10;
    border-radius: 10px;
  }

  span {
    font-size: 8px;
    color: #fff;
    position: absolute;
    left: 20px;
    top: 95px;
    // top: 10px;
  }
}

.card {
  width: 104px;
  height: 156px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;

  img {
    width: 104px;
    height: 104px;
    border-radius: 10px;
  }

  ;

  .card-text {
    height: 35px;
    line-height: 18px;
    overflow: hidden;
    display: -ms-flexbox;
    display: flex;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -o-text-overflow: ellipsis;
    text-overflow: ellipsis;
    -webkit-box-orient: vertical;
    font-size: 12px;
    color: #333
  }

}</style>